<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>

<script type="text/javascript">
	function knowledgeCategoryTree_onNodeClick(event, treeId, treeNode) {

		knowledgeItemGrid.search({
			"field" : "treenode_path",
			"op" : "bw",
			"data" : treeNode.treenodePath
		});
	}

	function rebulidIndex() {

		$("#dlgRebulidIndex").dialog({

			width : 360,
			height : 230,
			title : "重建索引",
			buttons : [ {
				text : "确定",
				'class' : 'nui-mainbtn',
				click : function() {

					var rebulidAll = $("#chkRebulidAll:checked").val(), rebulidKng = $("#chkRebulidKng:checked").val(), rebulidIcd = $("#chkRebulidIcd:checked").val();

					isperp.showLoading({
						onThisWindow : true
					});
					$("#dlgRebulidIndex").dialog("close");
					$.get('knowledge/knowledgeItem/rebuildIndex', {
						rebulidAll : rebulidAll,
						rebulidKng : rebulidKng,
						rebulidIcd : rebulidIcd
					}, function() {
						isperp.hideLoading({
							onThisWindow : true
						});
						isperp.tooltip('重建成功');

					});
				}

			}, {
				text : "关闭",
				click : function() {
					$(this).dialog("close");
				}

			} ]

		});

	}
</script>

<div id="dlgRebulidIndex" style="display: none;padding:15px">

	重建方式：<input type="checkbox" id="chkRebulidAll"> <label
		for="chkRebulidAll">是否重建所有？</label>如果不选择则增量重建。<br> 重建内容：<input
		type="checkbox" id="chkRebulidKng" checked="checked"><label
		for="chkRebulidKng">知识库 </label> &nbsp;&nbsp;<input type="checkbox"
		id="chkRebulidIcd"><label for="chkRebulidIcd">事件单 </label><br>
	<br> <b>重建规则说明：</b>索引来源包括知识库和事件单；增量重建按照最后编辑时间大于上次重建时间的数据。

</div>
<div class="box no-border">

	<div class="box-left">
		<isperp:tree id="knowledgeCategoryTree">
			<isperp:async enable="true" autoParam="'id'"
				otherParam="{asyncLoad:1}"
				url="knowledge/knowledgeCategory/getTree?showRoot=1&showNumber=1">
			</isperp:async>
			<isperp:callback onClick="knowledgeCategoryTree_onNodeClick">
			</isperp:callback>
			<isperp:view showIcon="true" showLine="true" nameIsHTML="true"
				showTitle="true"></isperp:view>

		</isperp:tree>
	</div>
	<div class="box-right">
		<isperp:grid url="knowledge/knowledgeItem/manageList"
			gridId="knowledgeItemGrid" gridTitle="${pageTitle}"
			autoReloadTreeMenu="knowledgeMenu" sortname="create_date" sortorder="desc"
			cusViewUrl="knowledge/knowledgeSearch/knowledgeInfoView"
			cusFormatterActions="true" cusEditUrl="knowledge/knowledgeItem/edit"
			ondbClickRowEvent="knowledgeItemGrid.edit(rowid);"
			cusDeleteUrl="knowledge/knowledgeItem/delete" editOrDeleteRightControl="true"
			excelExportUrl="knowledge/knowledgeItem/excelExport">
			<jsp:attribute name="toolbar">
			
			<isperp:treeMenu id="knowledgeMenu" targetGridId="knowledgeItemGrid">
		<isperp:async enable="true" url="knowledge/knowledgeItem/manageMenu"></isperp:async>
		<isperp:view showIcon="false" showLine="false" nameIsHTML="true"
						showTitle="true"></isperp:view>
		<isperp:callback onClick="knowledgeMenuTree_onNodeClick"
						onAsyncSuccess="knowledgeMenuTree_onNodeClickFirst();">
		</isperp:callback>
	</isperp:treeMenu>
			
			<button onclick="rebulidIndex()">重建索引</button>
			
			
			
			</jsp:attribute>
			<jsp:attribute name="searchbar">
				<table class="search-table">
					<tbody>
						<tr>
							<td align="right">标题：</td>
							<td><input type="text" field="title" op="cn">
							</td>
							<td align="right">关键字：</td>
							<td><input type="text" field="keyword" op="cn">
							</td>
						</tr>
						<tr>
							<td align="right">发布时间：</td>
							<td><input id="publishDateStart" type="date"
								field="publish_date" op="gt" style="width: 68px" />~<input
								id="publishDateEnd" type="date" field="publish_date" op="lt"
								style="width: 68px" />
							</td>
							<td align="right">创建人：</td>
							<td><input type="text" field="creator_name" op="cn">
							</td>
						</tr>
					</tbody>
				</table>
			</jsp:attribute>
			<jsp:body>
				<isperp:column name="id" title="id" hidden="true"></isperp:column>	
				<isperp:column name="title" title="标题" width="120">
				</isperp:column>
				<isperp:column name="keyword" title="关键字" width="80">
				</isperp:column>
				<isperp:column name="status" title="状态" width="30">
				</isperp:column>
				<isperp:column name="creator_name" title="创建人" width="60">
				</isperp:column>
				<isperp:column name="publish_date" title="发布时间" width="80">
		 		</isperp:column>
				
				<isperp:column name="read_times" title="浏览数" width="30">
				</isperp:column>
				<isperp:column name="commentary_times" title="评论数" width="30">
				</isperp:column>
				
				
			</jsp:body>

		</isperp:grid>
		<isperp:operate code="KNG_MAINTAIN"></isperp:operate>
	</div>

</div>
